package com.liuweijiaoyu.demo.widgets.oxny;

import android.content.Context;
import android.util.DisplayMetrics;
import android.view.Display;
import android.view.WindowManager;

import com.liuweijiaoyu.demo.App;

/**
 * Created by lt
 * Created on 2017/9/26 0026.
 */

public class UIUtils {
    public static int dip2px(float dpValue) {
        WindowManager wm = (WindowManager) App.getAppContext()
                .getSystemService(Context.WINDOW_SERVICE);
        Display display = wm.getDefaultDisplay();
        DisplayMetrics dm = new DisplayMetrics();
        display.getMetrics(dm);
        float scale = dm.density;
        return (int) (dpValue * scale + 0.5f);
    }

}
